# coding = utf-8
# rule vars
charset = "utf-8"  # e.g.: utf-8, gbk etc.
name = "笔下文学"
url = "https://www.bxwxorg.com/"  # index url
search = {
    "url": "https://www.bxwxorg.com/search.html",
    "method": "post",
    "input": "searchkey",
    "data": {},
    "headers":{}
}  # search page
searchPattern = {
    "bookLists":"bs:('dl')",    # booklists result must be list
    "bookName":"bs:.h3.a.text",
    "bookAuthor":"bs:(class_='book_other')[0].span.text",
    "bookUrl":"bs:.a['href']",
    "lastChapter":"bs:(class_='book_other')[1].a.text",
    "bookCover":"bs:.img['src']",
    "whichBook":"books[0]"
}
bookPattern={
    "tocUrl":"book[2]",  # same as the bookUrl
    "bookIntro":"bs:.find(id='intro').p.text"   # book introduction text
}
tocPattern={
    # "chapterList":"",
    # for decreasing the search scope of chapter
    "chapterUrl":"bs: and [x['href'] for x in i('dt')[1].find_all_next('a',href=re.compile('^.+read.+html$'))]",
    "chapterName":"bs: and [x.text for x in i('dt')[1].find_all_next('a',href=re.compile('^.+read.+html$'))]"
}
chapterPattern={
    "name": "bs:.h1.text",
    "content":"bs:(id='content')[0].text",
    "filter":"re.sub('(因.+大量用户.+?！)','',re.sub('非常感谢.+笔.*下.+$','',content.replace('\\n','<br>')))",
}